﻿{extend name="common/base"/}
{block name="style"}
<style>
    html, body {
        background:#ff464e;
        height: 100%;
        
    }
    .safari_img {

        z-index: 10;

        position: fixed;

        top: 10px;

        right: 0;

        position: fixed;


    }



    .safari_img img {

        width: 100%;

        margin: 0px;

    }



    .tinymask {

        z-index: 10;

        width: 100%;

        height: 100%;

        position: fixed;

        top: 0;

        left: 0;

        -webkit-tap-highlight-color: transparent;

    }
</style>
{/block}
<body> 
    <!--头部-->
    {block name="header"}{/block}
    <!--end头部-->

    <!--内容-->
    {block name="content"}
    <div class="am-modal am-modal-alert" tabindex="-1" id="fq_alert">
  <div class="am-modal-dialog">
    <div class="am-modal-hd" id="fq_alert_title"></div>
    <div class="am-modal-bd" id="fq_alert_info">
    </div>
    <div class="am-modal-footer">
      <span class="am-modal-btn">确定</span>
    </div>
  </div>
</div>

<div class="am-modal am-modal-confirm" tabindex="-1" id="fq_confirm">
  <div class="am-modal-dialog">
    <div class="am-modal-hd" id="fq_confirm_title"></div>
    <div class="am-modal-bd" id="fq_confirm_info"></div>
    <div class="am-modal-footer">
      <span class="am-modal-btn" data-am-modal-confirm="">确定</span>
    </div>
  </div>
</div>



<!--iphone/android弹窗提示打开手机浏览器-->

<div class="safari_top" style="display: block;">
<a href="javascript:history.go(-1)" style="z-index:9999">
<img src="__STATIC__/images/return.png" class="fq-return am-margin-top-sm am-margin-left-sm" style="width:40px;z-index:9999">
</a>
    <div class="tinymask am-padding-0 am-margin-0"></div>

    <div class="safari_img am-text-right">

        <img id="go_tip" src="" alt="" onclick="history.go(-1)">
        <div class="cxx-text-white am-text-center am-text-sm" style="position:relative; top:-20px;">
            温馨提示：
            <br>
            有【手机淘宝】的选择淘口令购买方式更方便哦~
        </div>

        <div class="cxx-text-white am-text-center am-text-sm am-round" style="padding-bottom: 10px; {empty name='goods'}display: none;{else /}margin-top: -2rem;{/empty}" >
        <span class="am-round am-padding-vertical-sm am-margin-top am-padding-horizontal am-inline-block cxx-goods-taokouling" data-id="{$goods.id}" data-activityId="{$goods.couponId}" data-title="{$goods.title}" data-img="{$goods.img}" data-couponPrice="{$goods.couponPrice}" data-discountPrice="{$goods.discountPrice}" data-couponUrl="{$clickUrl}" style="background:rgba(254, 222, 20, 0.6);box-shadow: 0 0 0 11px rgba(254, 222, 20, 0.2);">查看宝贝淘口令</span> 
        </div>
        
        <div class="cxx-text-white am-text-center am-text-sm am-round">
        <span class="am-round am-padding-vertical-sm am-margin-top am-padding-horizontal am-inline-block more_coupon" style="background:rgba(254, 222, 20, 0.6);box-shadow: 0 0 0 11px rgba(254, 222, 20, 0.2);">查看更多优惠券</span>

            
        </div>
        

    </div>

{/block}
{block name="script"}
<script type="text/javascript">
$(function() {
    $('.more_coupon').click(function(){
        
          window.location.href = "{:url('Index/index')}";
    })
    $('.cxx-goods-taokouling').on('click', function() {
        var id = $(this).attr('data-id'),
            activityId = $(this).attr('data-activityId'),
            title = $(this).attr('data-title'),
            img = $(this).attr('data-img'),
            couponPrice = $(this).attr('data-couponPrice'),
            discountPrice = $(this).attr('data-discountPrice'),
            couponUrl = $(this).attr('data-couponUrl'),
            url = '{:url("AjaxRequest/goodsDetails")}';
        $.getJSON(url,{id:id,couponId:activityId,title:title,img:img,couponPrice:couponPrice,discountPrice:discountPrice,couponUrl:couponUrl},function(data){
            if(data.code){
                var goods = data.data, str = '';
                str += '<div class="am-modal am-modal-alert cxx-modal" tabindex="-1"><div class="am-modal-dialog cxx-background-white">';
                str += '<div class="taologo btndh" style="background-image:url(' + goods.img + ')"></div>';
                str += '<div class="am-modal-bd  am-padding-top"><div class="taocon"><div class="taotitle am-padding-sm"><div class="cxx-tkl-detail">';
                str += '<ul class="am-list am-text-left">';
                str += '<li><b>【商品】</b>' + goods.title + '元</li>';
                str += '<li style="color:#ff464e"><b>【券额】</b> ' + goods.coupon_price + '元</li>';
                str += '<li style="color:#ff464e"><b>【券后价】</b> ' + goods.discount_price + '元</li>';
                str += '</ul></div>';
                str += '<div class="popwcontent" id="taocontent">';
                str += '<textarea style="border:0;undefined" class="copybox share" id="copy_key_android_nb" data-taowords="复制框内整段文，打开【手机淘宝】即可【领取优惠券】并购买' + goods.taokouling + '">【下单链接】 一键复制，打开【手机淘宝】即可【领取优惠券】并购买' + goods.taokouling + '</textarea></div>';
                str += '</div></div></div>';
                str += '<div class="am-modal-footer"><span class="am-modal-btn cxx-text-pink cxx-goods-copy"  data-am-modal-confirm="false">一键复制</span> <span class="am-modal-btn cxx-text-pink" data-am-modal-cancel>关闭窗口</span></div></div></div>';
                str += '<div class="am-dimmer am-active" data-am-dimmer="" style="display: block;"></div>';
                
                $('body').append(str);
        
                $('.cxx-modal').modal({target: 'cxx-modal',closeOnConfirm: false, closeViaDimmer: 0,width:300, dimmer:false});
                
                var $confirm = $('.cxx-modal');
                var $confirmBtn = $confirm.find('[data-am-modal-confirm]');
                var $cancelBtn = $confirm.find('[data-am-modal-cancel]');
                $confirmBtn.off('click.confirm.modal.amui').on('click', function() {
                     
                     var clipboard = new Clipboard('.cxx-goods-copy', {
                        target: function() {
                            return document.querySelector('.copybox');
                        }
                    });
    
                    clipboard.on('success', function(e){
                        e.trigger.innerHTML='<div class="am-text-success"><i class="am-icon-check-circle am-margin-right-xs"></i>复制成功</div>';
                        e.clearSelection();
                        cxxia.tips({msg:'复制成功', icon:'', time:1000});
                    });
                    
                    clipboard.on('error', function(e) {
                        cxxia.tips({msg:'由于您的浏览器不兼容或当前网速较慢，复制失败，请手动复制或更', icon:'', time:5000});
                    });
                    
    
                });
    
                $cancelBtn.off('click.cancel.modal.amui').on('click', function() {
                            $confirmBtn.html('一键复制');
                            $('.cxx-modal, .am-dimmer.am-active').remove();
                            $('body').removeAttr('class').removeAttr('style');
                                                        
                });
            }else{
                cxxia.tips({msg:data.msg, icon:'', time:1000});
            }
                        
        });
    
    })
});

</script>
<script>
var timer0 = "";
var timer1 = "";
$(function(){
        var ua = navigator.userAgent.toLowerCase();

        if (ua.match(/iphone/i) == "iphone" || ua.match(/ipad/i) == "ipad") {

            $(".safari_top").css("display", "block");

            $("#go_tip").attr("src", "__STATIC__/images/jump_coupon_ios.png");

        } else {

            $(".safari_top").css("display", "block");

            $("#go_tip").attr("src", "__STATIC__/images/jump_coupon_android.png");

        }

});
</script> 

<script>

   $(document).ready(function(e){
        //内部方法


        function is_weixin() {

            var ua = navigator.userAgent.toLowerCase();

            if (ua.match(/MicroMessenger/i) == "micromessenger" || ua.match(/qq\//i) == "qq/") {

                return true;

            } else {

                return false;

            }

        }



        function is_ios() {

            var ua = navigator.userAgent.toLowerCase();

            if (ua.match(/iphone/i) == "iphone" || ua.match(/ipad/i) == "ipad") {

                return true;

            } 

        }



        function openApp(url) {



            var tb_url = "{$clickUrl}";

            var ifr = document.createElement('iframe');

            ifr.src = 'taobao://' + tb_url;

            ifr.style.display = 'none';

            document.body.appendChild(ifr);

            window.location = url;



        }



        function openIphoneApp_ios_9(url) {



            var tb_url = "{$clickUrl}";

            window.location = "taobao://" + tb_url;

            window.setTimeout(function () { window.location = url; }, 4000)



        }


     //函数执行

        var isWeixin = is_weixin();

        if (isWeixin) {

            var is_ios = is_ios();

            if (is_ios) {

                $("#go_tip").attr("src", "__STATIC__/images/jump_coupon_ios.png");



            } else {

                $("#go_tip").attr("src", "__STATIC__/images/jump_coupon_android.png");


            }

        } else {
            var is_ios = is_ios();
            if (is_ios) {

                $("#go_tip").attr("src", "__STATIC__/images/jump_coupon_ios.png");

                

            } else {

                $("#go_tip").attr("src", "__STATIC__/images/jump_coupon_android.png");


            }
       
     
       $("body").html("<center style=\"margin-top: 10px;\">唤醒手机淘宝中...</center>");

            //只在有优惠券的时候执行

            var ua = navigator.userAgent.toLowerCase();
            var gourl = "{$clickUrl}";
            var arrEntities = {'amp' : '&'};
            gourl2 = decodeURIComponent(gourl);
            gourl3 = gourl2.replace(/&(amp);/ig, function(all, t){return arrEntities[t]})
            //alert(gourl3);

            if (ua.match(/iphone os 9/i) == "iphone os 9") {
                                //openIphoneApp_ios_9("��i���jwmj�ڡ�&��.���y׭j)^�@���'��C�353k�Ĥ���?`Zʳ��Xs`G۽�,�a[���"础����U�����~�j�dĄ����,�
��Ƭe8^�T��kK�p�
��i�b�+r!��߇�W���7q�\ѯ{����}wF�����m��^���t�]����랼릦�+^��u�����v�v����}诵�����i�");
                openIphoneApp_ios_9(gourl3);
                
            } else {
                                //openApp("��i���jwmj�ڡ�&��.���y׭j)^�@���'��C�353k�Ĥ���?`Zʳ��Xs`G۽�,�a[���"础����U�����~�j�dĄ����,�
��Ƭe8^�T��kK�p�
��i�b�+r!��߇�W���7q�\ѯ{����}wF�����m��^���t�]����랼릦�+^��u�����v�v����}诵�����i�");
                openApp(gourl3);
                
            }

        }
      

    });

</script>
{/block}